<?php $stats = Doctrine::getTable('BbPlayerStat')->getAvgStat($playerId, $season=2)?>
<table style="width:100%;" class="mod-data" width="100%">
  <thead>
    <tr>
	  <th scope="col">Улирал</th>
      <th scope="col">Тоглолт</th>
      <th scope="col">Fgm-Fga</th>
      <th scope="col">Pct</th>
      <th scope="col">Pt3m-Pt3a</th>
      <th scope="col">PCT</th>
      <th scope="col">Ftm-Fta</th>
      <th scope="col">PCT</th>
      <th scope="col">Offreb</th>
      <th scope="col">Reb</th>
      <th scope="col">Ast</th>
      <th scope="col">Tov</th>
      <th scope="col">Stl</th>
      <th scope="col">Blk</th>
      <th scope="col">Pf</th>
      <th scope="col">Pts</th>
    </tr>
  </thead>
  <tbody>
      <tr>
        <?php
         $gp = 0;
         $afgm = 0;  
         $afga = 0;  
         $apt3m = 0;  
         $apt3a = 0;  
         $aftm = 0;  
         $afta = 0;  
         $aoff = 0;  
         $areb = 0;  
         $aast = 0;  
         $atov = 0;  
         $astl = 0;  
         $ablk = 0;  
         $apf = 0;  
         $apts = 0;  
      	 foreach ( $stats as $stat ):
      		$afgm += $stat->getFgm();
      		$afga += $stat->getFga();
      		$apt3m += $stat->getPt3m();
      		$apt3a += $stat->getPt3a();
      		$aftm += $stat->getFtm();
      		$afta += $stat->getFta();
      		$aoff += $stat->getOffreb();
      		$areb += $stat->getReb();
      		$aast += $stat->getAst();
      		$atov += $stat->getTov();
      		$astl += $stat->getStl();
      		$ablk += $stat->getBlk();
      		$apf += $stat->getPf();
      		$apts += $stat->getPts();
      		$gp++;  
      	 endforeach;
      	 
      	 $afgm = $afgm / $gp; 
      	 $afga = $afga / $gp; 
      	 $apt3m = $apt3m / $gp; 
      	 $apt3a = $apt3a / $gp; 
      	 $aftm = $aftm / $gp; 
      	 $afta = $afta / $gp; 
      	 $aoff = $aoff / $gp; 
      	 $areb = $areb / $gp; 
      	 $aast = $aast / $gp; 
      	 $atov = $atov / $gp; 
      	 $astl = $astl / $gp; 
      	 $ablk = $ablk / $gp; 
      	 $apf = $apf / $gp; 
      	 $apts = $apts / $gp; 
      	?>
        <td><?php echo $gp   ?></td>
        <td><?php echo $gp ?></td>
        <td><?php echo $afgm.'-'.$afga ?></td>
        <td><?php echo $afgm*100/$afga.'%' ?></td>
        <td><?php echo $apt3m.'-'.$apt3a ?></td>
        <td><?php echo $apt3m*100/$apt3a.'%' ?></td>
        <td><?php echo $aftm.'-'.$afta ?></td>
        <td><?php echo $aftm*100/$afta.'%' ?></td>
        <td><?php echo $aoff ?></td>
        <td><?php echo $areb ?></td>
        <td><?php echo $aast ?></td>
        <td><?php echo $atov ?></td>
        <td><?php echo $astl ?></td>
        <td><?php echo $ablk ?></td>
        <td><?php echo $apf ?></td>
        <td><?php echo $apts ?></td>
      </tr>
    
  </tbody>
</table>